<template>
  <div class="container-main">
    <el-aside width="200px">
      <el-scrollbar>
        <el-menu :default-active="route.path">
          <el-sub-menu index="1">
            <template #title>
              <el-icon>
                <Folder/>
              </el-icon>
              <span>内容管理</span>
            </template>
<!--            添加分类-->
            <el-menu-item-group>
              <template #title>分类</template>
              <el-menu-item index="1-1" @click="goToCreateClass"
              >新建分类
              </el-menu-item
              >
              <el-menu-item index="/home/categoryList" @click="goToCreateList"
              >分类列表
              </el-menu-item
              >
            </el-menu-item-group>
            <!--            编辑物品-->
            <el-menu-item-group>
              <template #title>物品</template>
              <el-menu-item index="/home/ItemEdit" @click="gotoItemEdit"
              >添加物品
              </el-menu-item
              >
              <el-menu-item index="/home/ItemList" @click="gotoItemList"
              >物品列表
              </el-menu-item
              >
            </el-menu-item-group>
            <!--            编辑英雄-->
            <el-menu-item-group>
              <template #title> 英雄</template>
              <el-menu-item index="/home/herosEdit" @click="gotoHerosEdit"
              >添加英雄
              </el-menu-item
              >
              <el-menu-item index="/home/herosList" @click="gotoHerosList"
              >英雄列表
              </el-menu-item
              >
            </el-menu-item-group>


          </el-sub-menu>
          <!--          运营管理-->
          <el-sub-menu index="2">
            <template #title>
              <el-icon>
                <Lock/>
              </el-icon>
              <span>运营管理</span>
            </template>
            <!--            编辑文章-->
            <el-menu-item-group>
              <template #title>文章</template>
              <el-menu-item index="/home/articleEdit" @click="gotoArticleEdit"
              >添加文章
              </el-menu-item
              >
              <el-menu-item index="/home/articleList" @click="gotoArticleList"
              >文章列表
              </el-menu-item
              >
            </el-menu-item-group>
            <!-- 编辑广告 -->
            <el-menu-item-group>
              <template #title>广告位</template>
              <el-menu-item index="/home/adEdit" @click="gotoAdEdit"
              >添加广告
              </el-menu-item
              >
              <el-menu-item index="/home/adList" @click="gotoAdList"
              >广告列表
              </el-menu-item
              >
            </el-menu-item-group>
          </el-sub-menu>
          <!--          系统设置-->
          <el-sub-menu index="3">
            <template #title>
              <el-icon>
                <Lock/>
              </el-icon>
              <span>运营管理</span>
            </template>
<!--            添加管理员-->

            <el-menu-item-group>
              <template #title>管理员</template>
              <el-menu-item index="/home/adminUserCreate" @click="gotoAdminUserCreate"
              >新建分类
              </el-menu-item
              >
              <el-menu-item index="/home/adminUserList" @click="gotoAdminUserList"
              >分类列表
              </el-menu-item
              >
            </el-menu-item-group>
          </el-sub-menu>
        </el-menu>
      </el-scrollbar>
    </el-aside>
    <el-main>
      <!-- 内容部分 -->
      <el-scrollbar>
        <router-view></router-view>
      </el-scrollbar>
    </el-main>
  </div>
</template>

<script lang="ts" setup>
import {useRoute, useRouter} from "vue-router";
import {Folder, Lock} from '@element-plus/icons-vue'

const route = useRoute();
const router = useRouter();
const goToCreateClass = () => {
  router.push({
    path: "/home/createClass",
  });
};

const goToCreateList = () => {
  router.push({
    path: "/home/categoryList",
  });
};

//跳转添加物品页面
const gotoItemEdit = () => {
  router.push({path: "/home/ItemEdit"});
};

//跳转物品列表页面
const gotoItemList = () => {
  router.push({path: "/home/ItemList"});
};

//跳转添加英雄页面
const gotoHerosEdit = () => {
  router.push({path: "/home/herosEdit"});
};

//跳转英雄列表
const gotoHerosList = () => {
  router.push({path: "/home/herosList"});
};

//跳转文章编辑
const gotoArticleEdit = () => {
  router.push({path: "/home/articleEdit"});
};
//跳转文章列表页面
const gotoArticleList = () => {
  router.push({path: "/home/articleList"});
};
//跳转广告编辑页面
const gotoAdEdit = () => {
  router.push({path: "/home/adEdit"});
};
//跳转广告列表
const gotoAdList = () => {
  router.push({path: "/home/adList"});
};
//跳转到增加管理员
const gotoAdminUserCreate = () => {
  router.push({path:'/home/adminUserCreate'})
}
const gotoAdminUserList = () => {
  router.push({path:'/home/adminUserList'})
}
</script>

<style lang="less" scoped>
.container-main {
  display: flex;
  height: 100%;

  .el-aside {
    background-color: #1c3879;
  }
}
</style>
